package com.sc;

import java.util.Arrays;

public class SortTest {
    private final static String HEX = "0123456789ABCDEF";

    public static void main(String[] args) {
//        int[] array = {3, 4, 2, 5, 6, 4, 2, 1, 3, 5, 8, 7, 9, 9, 7, 6, 4, 3};
//        System.out.println(Arrays.toString(array));
//        Arrays.sort(array);
//        System.out.println(Arrays.toString(array));

        int i = 1;
        System.out.println(i << 2);
        System.out.println(~i);

//        HEX.charAt((b >> 4) & 0x0f)
//
//                byte b = 1;
    }

    public static String toHex(byte[] buf) {
        if (buf == null)
            return "";
        StringBuffer result = new StringBuffer(2 * buf.length);
        for (int i = 0; i < buf.length; i++) {
            appendHex(result, buf[i]);
        }
        return result.toString();
    }

    private static void appendHex(StringBuffer sb, byte b) {
        sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f));
    }

}
